Setting the Root Directory of Your Sources
As stated before, code bases, in general, consist of many projects, sub-projects, components and/or modules. Often, the build of each entity is dependent on information from other entities, such as include directories.
Helix QAC projects are designed to be portable. For example, they can be checked into version control on one machine, and then checked out on another machine for analysis. However, in order for this to work, dependencies, such as third party and project include directories, must be capable of being located wherever the project has been checked out or moved.
Some companies maintain build-dependent directories absolutely. This necessitates that they are installed in the same absolute location on every machine that needs to build the project. Others maintain build-dependent directories relative to the current project. Many companies have a mixture of both absolute and relative build-dependent directories.
Helix QAC allows you to set multiple root directories for source files. More often than not, just a single root directory is enough, but you may need more than one root directory if your project uses third party code, for example.
By default, the source root directory is set to be the same as the project root directory, specified when the project was created. To change the source root directory, or to add additional directories, navigate to:
Project : Open Project Properties : Project tab : Root Directories
The PROJECT_ROOT
setting holds the location of the Helix QAC project. This cannot be changed. The SOURCE_ROOT
setting is initially set to the PROJECT_ROOT
value, but can be changed to a location more suited to your own file structure. To change the location, double-click on the cell in the Value column, modify the text, and click Save at the bottom of the screen.
-i .\aaa\inc
) to a CCT file, PROJECT_ROOT
is the start directory for that relative path. In the case of this example, -i PROJECT_ROOT\aaa\inc
) is searched.If you need to have more than one source root directory, click on the Add button. In the dialog box that appears, specify a Name to describe the location, and either type in the Directory location, or use the icon to the right of the field to browse to it. The location can refer to other root directories by wrapping the name in ${ }
. A path can then be appended, for example: ${PROJECT_ROOT}\src\calcs
to refer to a location two levels below the project root.
You can add files to a project by selecting Add File(s) from the context menu for the required project on the main screen.
Helix QAC then determines the "best match" of the file location to a source root. If there is no match, the absolute path to the file is used.
The power of project roots can be seen if a project definition is copied between users. Often, user A will specify the list of source files for the project before copying the project definition across to user B. It may be that the two users have the same location for third party code, but a different location for the source within the project itself. If so, then user B can just adjust the source roots to suit the locations on the local machine. The project is now ready for use. There is no need for user B to re-synchronize the project, as the files added by the user A will be found in their local locations.
In addition, the changes made by user B are not set into the normal project definition file prqaproject.xml
: rather,
they are stored in a user-specific file "prqa\qa-framework-app.xml
". Project-specific or user-specific roots can be viewed for editing using the radio buttons beneath the table. The significance is that the original "prqaproject.xml
" is still valid for all users of the project, and can be checked into source control without worrying about per-user differences. (Newly-added roots will be set into "prqaproject.xml
" so that they are available to all users.)
Each time that a different source root is specified, Helix QAC will check whether any existing source files are better matched to the new root rather than an existing root. If so, the file will be put under the new root. That is, the path shown will be relative to the new root rather than the old. This technique can be useful in shortening some relative paths: by setting a new root at a lower level in the directory hierarchy, files switching to the new root will have a shorter relative path.
For example, sample project "sample_cgicc_diff
" has three separate modules under its SOURCE_ROOT: src, demo
and diff
.
File CgiUtils
has relative path SOURCE_ROOT\src\cgicc\CgiUtils.cpp
. If a new root is added as:
CGICC_ROOT = ${SOURCE_ROOT}\src\cgicc
then, once the Project Properties dialog is closed, the files are reallocated. All the files that were under SOURCE_ROOT\src\cgicc
are now under root CGICC_ROOT.
CgiUtils.cpp
initially has the relative path SOURCE_ROOT\src\cgicc
, which might convert to the following absolute path:
If SOURCE_ROOT itself is changed to c:\dev\sample_cgicc_diff\src
, the relative path is unchanged, giving the following incorrect absolute path:
This retention of existing relative paths is necessary to find files in the situation where user B needs to adjust the path provided by user A.